const app = getApp()

var base = require('../../base.js');
Page({
    data: {
        name: "",
        authorized: false,
        activeNames: [], // 一级折叠项的状态
        activeChildrenNames: [] // 二级折叠项的状态
    },
 /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setData({
      _t: base._t()
    });
  },
    // 点击登录
    getUserProfile: function(e) {
      wx.navigateTo({
        url: '/pages/login/index',
      });
    },

    // 处理一级折叠面板的展开和收起事件
    onCollapseChange: function(event) {
        this.setData({
            activeNames: event.detail
        });
    },

    // 处理二级折叠面板的展开和收起事件
    onChildrenChange: function(event) {
        this.setData({
            activeChildrenNames: event.detail
        });
    },

    onLoad: function(options) {
 
    },

    onShow: function() {
      if(wx.getStorageSync("token") != ""){
               // const token = wx.getStorageSync('token');
        // if (token) {
        //     wx.request({
        //         url: app.url + 'user/info',
        //         method: "GET",
        //         header: { Authorization: `Bearer ${token}` },
        //         success: (res) => {
        //             this.setData({
        //                 authorized: true,
        //                 name: "欢饮您，123"
        //             });
        //         }
        //     });
        // }
      }
 /**
   * 生命周期函数--监听页面显示
   */
  
    this.setData({
      _t: base._t()
    });

    },
      onShareAppMessage: function (res) {
        // if (res.from === 'button') {
        //   // 来自页面内转发按钮
        //   console.log(res.target)
        // }
        return {
          title: 'Guzal免费证件照',
          path: '/page/home/index'
        }
      }
})
